//
//  DRFoodPairingFooterView.m
//  DoctorRen
//
//  Created by Lemon on 2018/11/22.
//

#import "DRFoodPairingFooterView.h"
#import <Masonry/Masonry.h>

@implementation DRFoodPairingFooterView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        [self setupSubviews];
    }
    return self;
}


-(void) setupSubviews{
    self.contentView.backgroundColor = [UIColor whiteColor];
    self.addButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.addButton setTitle:@"添加早餐" forState:(UIControlStateNormal)];
    [self.addButton setImage:[UIImage imageNamed:@"添加早餐"] forState:UIControlStateNormal];
    [self.addButton.titleLabel setFont:[UIFont systemFontOfSize:15]];
    [self.addButton setTitleColor:There_Green forState:UIControlStateNormal];
    [self.addButton setImageEdgeInsets:(UIEdgeInsetsMake(0, 0, 0, 10))];
    [self addSubview:self.addButton];
//
//    self.changeButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
//    [self.changeButton setTitle:@"换一批" forState:(UIControlStateNormal)];
//    [self.changeButton setImage:[UIImage imageNamed:@"智能配餐_换一批"] forState:UIControlStateNormal];
//    [self.changeButton.titleLabel setFont:[UIFont systemFontOfSize:15]];
//    [self.changeButton setTitleColor:There_Green forState:UIControlStateNormal];
//    [self addSubview:self.changeButton];
    
    self.setEatButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.setEatButton setTitle:@"我吃了" forState:(UIControlStateNormal)];
    [self.setEatButton setImage:[UIImage imageNamed:@"我吃了"] forState:UIControlStateNormal];
    [self.setEatButton.titleLabel setFont:[UIFont systemFontOfSize:15]];
    [self.setEatButton setTitleColor:There_Green forState:UIControlStateNormal];
    [self.setEatButton setImageEdgeInsets:(UIEdgeInsetsMake(0, 0, 0, 10))];
    [self addSubview:self.setEatButton];
    
    [self.addButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.mas_equalTo(0);
        make.bottom.mas_equalTo(-10);
        make.width.mas_equalTo(SCREEN_WIDTH / 3);
    }];
//
//    [self.changeButton mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo(0);
//        make.left.mas_equalTo(self.addButton.mas_right);
//        make.bottom.mas_equalTo(-20);
//        make.width.mas_equalTo(SCREEN_WIDTH / 3);
//    }];
    
    [self.setEatButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(0);
        make.left.mas_equalTo(0);
        make.bottom.mas_equalTo(-10);
        make.right.mas_equalTo(0);
    }];
    
    UIView *lineView = [UIView new];
    lineView.backgroundColor = UIColorFromHex(0xfafafa);
    [self addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.mas_equalTo(0);
        make.height.mas_equalTo(10);
    }];
    [self.addButton addTarget:self action:@selector(clickAddBtn) forControlEvents:(UIControlEventTouchUpInside)];
//    [self.changeButton addTarget:self action:@selector(clickChangeBtn) forControlEvents:UIControlEventTouchUpInside];
    [self.setEatButton addTarget:self action:@selector(clickSetEatBtn) forControlEvents:UIControlEventTouchUpInside];
}

-(void) clickAddBtn{
    if (self.delegate && [self.delegate respondsToSelector:@selector(didSelectedAddButon:)]) {
        [self.delegate didSelectedAddButon:self.section];
    }
}
//
//-(void) clickChangeBtn{
//    if (self.delegate) {
//        [self.delegate didSelectedChangeButton:self.section];
//    }
//}

-(void) clickSetEatBtn{
    if (self.delegate && [self.delegate respondsToSelector:@selector(didSelectedSetEatButton:)]) {
        [self.delegate didSelectedSetEatButton: self.section];
    }
}
@end
